package demo;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: syyyy
 * Date: 2025-07-06
 * Time: 18:20
 */
public class Test {
    public static void main(String[] args) {

    }
    public static void Sort(Student[] students){
        for(int i=0;i<students.length;i++){
            for(int j=0;j<students.length-i-1;j++){
                if(students[j].compareTo(students[j+1])>0){
                    Student tmp=students[j];
                    students[j]=students[j+1];
                    students[j+1]=tmp;
                }
            }
        }
    }
    public static void main1(String[] args) {
        Student[] students=new Student[3];

        students[0]=new Student("小苏",12);
        students[1]=new Student("小陈",10);
        students[2]=new Student("小刘",15);

        Sort(students);

        System.out.println("排好后:"+Arrays.toString(students));

    }
}



